<!DOCTYPE html>
<html>

<head>
    <title>Example</title>
    <!-- lifehacker.com-------js启蒙读物
        使用说明参见:http://lifehacker.com/5744113/learn-to-code-the-full-beginners-guide
        《JavaScript权威指南(第六版)》, 机械工业出版社
        《JavaScript设计模式》, 人民邮电出版社
    -->
</head>

<body>
    <!-- null值是值 -->
    <script type="text/javascript">
       var MyData = {
            name: "Adam",
            city: null,
        };
        document.writeln("Var: " + MyData.weather);
        document.writeln("Prop: " + ("weather" in MyData));

        MyData.weather = "sunny";
        document.writeln("Var: " + MyData.weather);
        document.writeln("Prop: " + ("weather" in MyData));

        MyData.weather = null;
        document.writeln("Var: " + MyData.weather);
        document.writeln("Prop: " + ("weather" in MyData));

        if (!MyData.name) {
            document.writeln("name IS null or undefined");
        }else{
            document.writeln("name is NOT null or undefined");
        }

        if (!MyData.city) {
            document.writeln("name IS null or undefined");
        }else{
            document.writeln("name is NOT null or undefined");
        }

        // null与undefined值的相等和等同比较,区分需要用===

        var firstVal = null;
        var secondVal;

        var equality = firstVal == secondVal;
        var identity = firstVal === secondVal;
        // 断点调试debugger
        // debugger;
        document.writeln("Equality: " + equality);
        document.writeln("Identity: " + identity);

    </script>
</body>

</html>